package com.boot.generic;

public class NormalGeneric<T> {
    private T data;
    private Integer a;

    public NormalGeneric(){

    }

    public NormalGeneric(T data,Integer a){
        this.data = data;
        this.a=a;
    }

    public T getData(){
        return data;
    }

    public void setData(T data){
        this.data = data;
    }

    /**
     * 泛型方法 泛型声明在<>内
     */
    public <K,E> E getA(K k,E e){
        return e;
    }

    /**
     * @param args
     */
    public static void main(String[] args) {
        // TODO Auto-generated method stub
        NormalGeneric<String> normalGeneric = new NormalGeneric<>();
        normalGeneric.setData("hello Generic");
        //normalGeneric.setData(12); //编译不通过报错，因为已经声明了泛型类的类型了
        System.out.println(normalGeneric.getData());
        normalGeneric.getA("a",2);


    }
}
